/****************************************************************************************
 Copyright © 2003-2012 ZTEsoft Corporation. All rights reserved. Reproduction or       <br>
 transmission in whole or in part, in any form or by any means, electronic, mechanical <br>
 or otherwise, is prohibited without the prior written consent of the copyright owner. <br>
 ****************************************************************************************/
package com.iwhalecloud.bss.kite.cucc.service.attr.handler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.service.util.ProdCateUtil;
import com.iwhalecloud.bss.kite.manager.api.IOperateSceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <Description> <br>
 *
 * @author liaojing<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2022年01月20日 <br>
 * @since R9.0<br>
 */


public class FloatingPopulationModeAttrHandler extends AbstractAttrHandler<KiteInst, AttrData>{
    @Autowired
    private IOperateSceneInstService operateSceneInstService;

    @Override
    public void after(KiteAttr attr, KiteInst inst, AttrData data) {
        //产品变更 延期分组置灰 融合追加
        if (KiteStringUtils.equalsAny(data.getServiceOfferId(),"2826", "2024")
            && (KiteStringUtils.isEqual(attr.getGroupId(), "300000173") || KiteStringUtils.equalsAny(inst.getSpecId(), ProdCateUtil.getMainMemberProdId(ProdCateUtil.GIFT_YFCPE_PROD), ProdCateUtil.getMainMemberProdId(ProdCateUtil.GIFT_YFLD_PROD)))) {
            attr.setIsEdit(KeyConsts.IFTRUE_F);
            operateSceneInstService
                .setAttr(data.getSceneInstId(), inst.getInstType(), inst.getInstId(), attr);
        }
        super.after(attr, inst, data);
    }
}
